package com.guan.service;

import com.guan.core.annotation.Autowired;
import com.guan.core.annotation.Bean;
import com.guan.jdbc.JDBCBaseDao;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 管理员相关服务
 * Created by Administrator on 2018/1/21 0021.
 */
@Bean("adminService")
public class AdminService {
    @Autowired("jdbcBaseDao")
    private JDBCBaseDao jdbcBaseDao;

    /**
     * 根据用户名和密码验证登录
     * @param userName
     * @param password
     * @return
     */
    public Map<String,Object> doLogin(String userName,String password){
        List<Object> parmes = new ArrayList<Object>();
        parmes.add(userName);
        parmes.add(password);
        String sql = "select admin_id id,admin_name name,admin_pwd pwd,admin_accoun accoun from t_sys_admin where admin_accoun = ? and admin_pwd = ?";
        Map<String,Object> res= jdbcBaseDao.queryMapForObject(sql,parmes);
        return  res;
    }
}
